//
//  Project.m
//  ModuleTesting
//
//  Created by duc nguyen van on 8/25/11.
//  Copyright 2011 STU. All rights reserved.
//

#import "Project.h"


@implementation Project
@synthesize umlDiagrams,name,date;

#pragma mark -
#pragma mark some Method

-(NSString*)getNowDateFormat{
	NSDate *tempDate = [NSDate date];
	NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease];
	[formatter setDateFormat:@"dd/MM/yyyy"];
	
	return [formatter stringFromDate:tempDate];
}

#pragma mark -
#pragma mark init

-(id)init{
	self = [super init];
	if (self) {
		umlDiagrams = [[NSMutableArray alloc] init];
		date = [self getNowDateFormat];
		name = @"Untitled";
	}
	return self;
}

#pragma mark For saving and loading file

-(id)initWithCoder:(NSCoder *)aDecoder{
	self = [super init];
	if (self) {
		self.umlDiagrams = [[NSMutableArray alloc] initWithArray:[aDecoder decodeObjectForKey:@"umlDiagrams"]];
		self.date = [aDecoder decodeObjectForKey:@"date"];
		self.name = [aDecoder decodeObjectForKey:@"name"];
	}
	return self;
}

-(void)encodeWithCoder:(NSCoder *)aCoder{
	[aCoder encodeObject:umlDiagrams forKey:@"umlDiagrams"];
	[aCoder encodeObject:date forKey:@"date"];
	[aCoder encodeObject:name forKey:@"name"];
}

@end
